// pages/baoxiuxq/baoxiuxq.ts
import Dialog from '@vant/weapp/dialog/dialog';
Page({
  data: {
    id: '',
  },
  set() {
    wx.navigateTo({
      url: '/pages/setbaoxiu/setbaoxiu?id=' + this.data.id
    })
  },
  dele() {
    Dialog.confirm({
      title: '是否要取消本报修',
    })
      .then(async () => {
        let res = await wx.http.put(`/cancel/repaire/${this.data.id}`)
        if (res.code == 10000) {
          wx.navigateTo({
            url: '/pages/mybaoxiu/mybaoxiu?id=' + this.data.id
          })
        } else {

        }
      })
      .catch(() => {

      });
  },
  async onLoad(options) {
    let res = await wx.http.get(`/repair/${decodeURIComponent(options.id)}`)
    this.setData({
      obj: res.data,
      id: decodeURIComponent(options.id)
    })
  },
})